using UnityEngine;
using Network;
using Com.Shinian.FcgProtocol.Pb;
using System.Collections.Generic;

public class NetMgr: MonoBehaviour
{
    static GameObject wait;
    public delegate void dele(ProxyModelUpdateEvent bubbleevent);
    Dictionary<string, dele> dic = new Dictionary<string, dele>();
    public static void Send(FCGChannel go)
    { 
        WebSocketConnect.instance.Pack((short)go);
        wait = UIMgr.PopView(ViewNames.WaitPanel);
    }
    public static void Send(FCGChannel go,byte[] data)
    {
        WebSocketConnect.instance.Pack((short)go,data);
        wait = UIMgr.PopView(ViewNames.WaitPanel);
    }
    public static void CloseWait()
    {
        Destroy(wait);
    }
    public static void Register(int code, ProxyModelUpdateListener.ProxyModelEventHandler handler)
    {
        WebSocketManager.instance.fcgProxyModelHandler().eventHandlers[code].BubbleEventHandler += handler;
    }
    public static void UnRegister(int code, ProxyModelUpdateListener.ProxyModelEventHandler handler)
    {
        WebSocketManager.instance.fcgProxyModelHandler().eventHandlers[code].BubbleEventHandler -= handler;
    }
}
